﻿Public Class inicioSesion
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
        TextBox3.Text = ""

        Dim c As New Conexion
        Session("VariableNombre") = TextBox1.Text

        Dim user As String = TextBox1.Text()
        Dim pwd As String = TextBox2.Text()
        Dim con As [String] = "Data Source=localhost;Initial Catalog=Bdd_Ventas;Integrated Security=True"

        c.SeleccionarLetras(TextBox3, "select login from Usuarios where Login='" & TextBox1.Text & "' and Clave='" & TextBox2.Text & "'")
        c.Seleccionar(TextBox4, "select idperfil from usuarios where login='" & TextBox1.Text & "'")
        lbl1.Text = Conexion.msj_sql_server

        If TextBox3.Text.Equals(user) Then
            lbl1.Text = "Este usuario si existe"

            If TextBox4.Text.Equals("2") Then
                Server.Transfer("index.aspx")
            Else
                Server.Transfer("indexAdministrador.aspx")
            End If

        Else
            lbl1.Text = "Este usuario no existe, vuelva a intentarlo"

        End If
    End Sub
End Class